package o;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.hms.framework.common.ContainerUtils;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;

public class fnr {
    public static Bundle ˋ(String str) {
        try {
            URL url = new URL(str);
            Bundle ˏ = ˏ(url.getQuery());
            ˏ.putAll(ˏ(url.getRef()));
            return ˏ;
        } catch (MalformedURLException e) {
            return new Bundle();
        }
    }

    public static Bundle ˏ(String str) {
        Bundle bundle = new Bundle();
        if (str != null) {
            for (String split : str.split(ContainerUtils.FIELD_DELIMITER)) {
                String[] split2 = split.split(ContainerUtils.KEY_VALUE_DELIMITER);
                try {
                    if (split2.length == 2) {
                        bundle.putString(URLDecoder.decode(split2[0], "UTF-8"), URLDecoder.decode(split2[1], "UTF-8"));
                    } else if (split2.length == 1) {
                        bundle.putString(URLDecoder.decode(split2[0], "UTF-8"), "");
                    }
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            }
        }
        return bundle;
    }

    public static String ˎ(Context context, String str) {
        String str2 = null;
        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(str, 64);
            for (Signature toByteArray : packageInfo.signatures) {
                byte[] toByteArray2 = toByteArray.toByteArray();
                if (toByteArray2 != null) {
                    str2 = fnl.ॱ(toByteArray2);
                    break;
                }
            }
        } catch (NameNotFoundException e) {
        } catch (Exception e2) {
        }
        return str2;
    }

    public static String ˊ(String str) {
        return TextUtils.isEmpty(str) ? "" : str;
    }

    public static String ˋ(Context context, String str) {
        if (context == null) {
            return "";
        }
        return fnj.ॱ().ˏ(context, str);
    }
}
